project (dvn_core)

set(dvn_core_srcs
	context.c
	dsim_utils.c
	events.c
	evtracker.c
	heap.c
	log.c
	main.c
	module.c
	process_controller.c
	process.c
	routing.c
	sim_master.c
	sim_slave.c
	sim_worker.c
	simop.c
	snricall.c
	sysconfig.c
	timer.c
	vci.c
)

set(dvn_core_hdrs
	context.h
	dsim_utils.h
	events.h
	evtracker.h
	heap.h
	log.h
	module.h
	process.h
	routing.h
	sim.h
	simop.h
	snricall_codes.h
	snricall.h
	sysconfig.h
	timer.h
	vci.h
)

#check for m and dl
#find_library (m dl rt)

#flex/bison
#set(FLEX_PREFIX_OUTPUTS true)
set(BISON_GENERATE_DEFINES true)
#set(BISON_PREFIX_OUTPUTS true)
include(CMakeUserUseBison)
include(CMakeUserUseFlex)

if( NOT BISON_EXECUTABLE OR NOT FLEX_EXECUTABLE )
	MESSAGE( SEND_ERROR "Bison and Flex are required" )
endif()

BISON_FILE(dsim_parser.y)
FLEX_FILE(dsim_lexer.l)

SET_SOURCE_FILES_PROPERTIES(lex.yy.c dsim_parser.tab.c PROPERTIES COMPILE_FLAGS "-I \"${CMAKE_CURRENT_SOURCE_DIR}\"")

include_directories(${CMAKE_SOURCE_DIR}/src/shared)

add_executable(dvn ${dvn_core_srcs} ${dvn_core_hdrs} dsim_parser.y dsim_lexer.l dsim_parser.tab.c dsim_parser.tab.h lex.yy.c)
target_link_libraries(dvn dvn_shared m dl)


